package com.jrx.anytxn.reporting.job.xib.step;

import com.jrx.anytxn.param.entity.PrOrganizationTable;
import com.jrx.anytxn.param.service.system.IOrganizationTableService;
import com.jrx.anytxn.reporting.constant.ReportingConstant;
import com.jrx.anytxn.reporting.mapper.ext.ExtAmlIATradingMapper;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobExecutionListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class TradingListener implements JobExecutionListener {

    @Autowired
    private IOrganizationTableService organizationTableService;
    @Resource
    private ExtAmlIATradingMapper extAmlIATradingMapper;


    @Override
    public void beforeJob(JobExecution jobExecution) {
        //支持重跑
        PrOrganizationTable org = organizationTableService.findByOrgIdForBatch(ReportingConstant.DEFAULT_ORG_NUMBER);
        extAmlIATradingMapper.deleteByEtlDt(org.getToday());
    }

    @Override
    public void afterJob(JobExecution jobExecution) {

    }
}
